(function () {
    // baseurl
    var baseUrl = './';
    // 资源加载
    var queue = new createjs.LoadQueue(true);
    var fest = [
        baseUrl + 'img/bg.jpg',
        baseUrl + 'img/alcohol_icon.png',
        baseUrl + 'img/up_icon.png',
        baseUrl + 'img/lower_icon.png',
        baseUrl + 'img/jiu_icon.png',
        baseUrl + 'sound/btn.mp3',
        baseUrl + 'sound/open.mp3',
    ]
    var progress = 0;
    queue.loadManifest(fest);
    queue.on("fileload", function () {
        progress++;
        var _prop = parseInt(progress / fest.length * 100);
        $('.loadCur').width(_prop + '%')
    }, this);
    queue.on("complete", function () {
        $(".loadDom").fadeOut("fast");
        $(".wrap").fadeIn("fast");
    }, this);

})();



$(document).ready(function () {
    queue.on('complete', function () {
        $('.loadDom').fadeOut(fast);
    })
}, this)


var audio = document.getElementById("audio");

function music() {
    audio.play();
    $(".btn_music").on('touchstart', function () {
        if (!audio.paused) {
            audio.pause();
            $(".btn_music>img").attr("src", "img/stop.png")
        } else {
            audio.play();
            $(".btn_music>img").attr("src", "img/play.png")
        }
    })
}

// ************************
$(document).ready(function () {
    setTimeout(() => {
        $('.twoBox').css('display', 'block');
        $('.alcohol_warp').css('display', 'none');
        openMusic.play()
    }, 1000);

    setTimeout(() => {
        $(".alcohol_warp").css({ "display": "none" })
        $(".twoBox").css({ "display": "none" })
        $(".receive").fadeIn();
        var mySwiper = new Swiper('.swiper-container2', {
            slidesPerView: 5,
            spaceBetween: 35,
            // freeMode: true,
            // centeredSlides: true,
            navigation: {
                nextEl: '.next2',
                prevEl: '.prev2',
            },
        })
    }, 1500);

    // 点击 接受赴约
    $(".receive__go").click(function () {
        // webwang.JoinRoom();
        btnMusic.play()
        $(this).addClass("animated pulse")
        setTimeout(() => {
            $(this).removeClass("animated pulse")
        }, 400);
        $(".mask_share1").css({ "display": "block" })
    });

    // 点击 拒绝赴约
    $(".refuse__go").click(function () {
        // webwang.JoinRoom();
        btnMusic.play()
        $(this).addClass("animated pulse")
        setTimeout(() => {
            $(this).removeClass("animated pulse")
        }, 400);
        $(".mask_share2").css({ "display": "block" })
    });

    // 点击遮罩层1返回
    $(".mask_share1").click(function () {
        $(".mask_share1").css({ "display": "none" })
    });

    // 点击遮罩层2返回
    $(".mask_share2").click(function () {
        $(".mask_share2").css({ "display": "none" })
    });

    // 点击我也要约
    $(".receive__metoo").click(function () {
        btnMusic.play()
        $(this).addClass("animated pulse")
        setTimeout(() => {
            $(this).removeClass("animated pulse")
        }, 400);
    })
});